//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================

#include <string.h>
#include <elatypes.h>

EXTERN_C size_t CDECL strlen(const char *str)
{
#ifdef _GNUC

#if defined(_x86)
    int temp;
    register int count;
    ASM("repne;"
        "scasb;"
        "notl %1;"
        "decl %1;"//not include '\0'
        :"=D" (temp), "=c" (count)
        :"0" (str), "a" (0x0), "1" (0xffffffffu));
    return count;
#endif    //if defined(_x86)

#endif    //ifdef _GNUC

    const char *p = str;
    while (*p) p++;
    return (size_t)(p - str);
}
